Graphical modeling languages use various types of components to represent structure and functionality graphically. For example, SIMULINK from The MathWorks, Inc. of Natick, Mass. is a block diagramming software package that represents structure and functionality graphically as model components using blocks and connections. Most graphical languages have the concept of organizing structure and functionality hierarchically and packaging certain hierarchical pieces into defined components that are stored in libraries or other locations. Using a defined component in a model is called ‘instantiating’ the component and the component as it is used in the model is an ‘instance’ of the defined component. One or many instances of a defined component may be instantiated in a model.
Most modern textual programming languages offer reusability, either by simple function libraries, class libraries or template libraries. Some textual programming languages extend component reusability by utilizing the concept of templatization. That is, reusable components leave some portion of their implementation to be defined by their point of use. For the purposes of this discussion, templatization may be subdivided into two simple categories, “functional templatization” and “structural templatization.”
Functional templatization allows a function to infer its functionality based on the argument passed to the function. For example, the MATLAB language (a technical programming language from The MathWorks, Inc.) has no strong typing and a MATLAB function's implementation places certain constraints on the types and dimensions of arguments passed it. It is only when the type and dimension of the input arguments are known at runtime that the full functionality of the MATLAB function is defined. Similarly, C++ provides this functionality such that functions may defer the determination of the types of functions' arguments to their point of use. In C++ this may be accomplished either by polymorphism in which case the arguments' types are determined at runtime or by template functions, in which case the arguments' types are determined at compile time.
Structural templatization allows data structures, or more generally a collection of programming language constructs, to defer the behavior of their components to their point of use or instantiation. In C++ this may be accomplished by polymorphism or by class templates.
Some graphical modeling languages already include the concept of functional templatization. For example, SIMULINK blocks do not necessary require their input or parameter types (data type, dimension, sample time, etc) to be fully determined when the blocks are defined. Rather, these attributes are determined at their point of use. For example, the Gain block does not require a specific gain format or input dimension but does require them to be consistent at the point of use.
It would be beneficial to model designers in a graphical modeling environment to be able to graphically manage a form of structural templatization that allows implementation information from a component to be propagated to interface model components. Such a form of structural templatization would allow a designer to quickly merge interface information from a component with a defined interface with the content from other components thus increasing the flexibility, reusability, and efficiency of the model design process. Unfortunately, conventional graphical modeling languages do not provide a mechanism for graphically performing structural templatization that allows the interface of a model component to be separated from the content of the model component and propagated to other instantiated model components.
Brief Summary
The illustrative embodiment of the present invention provides a mechanism for graphically performing structural templatization in a graphical model. A model component with a defined interface is designated as an “interface component” and includes at least one external interface port and one or more internal ports. An instance of the interface component is instantiated in a graphical model and exposes the external interface port. A user also instantiates in the graphical model an instance of a component that is designated as an “implementation component” that includes model functional content and which exposes an implementation port. The user connects the exposed interface port and implementation port and the internal port information from the interface component programmatically merges with the content of the implementation component. The model designer is thus able to concentrate on separately providing interface and content information during the design of the graphical model.
In one aspect of the present invention, in a graphical modeling environment, a method of performing structural templatization includes the step of providing a graphical model with multiple components. The method instantiates an instance of an interface component into the graphical model. The instance of the interface component includes model connection information. The method also instantiates an instance of an implementation component into the graphical model. The instance of the implementation component includes model functional content. The method additionally connects the interface component and the implementation component. The connection information merging with the functional content of the implementation component.
In another aspect of the present invention in a graphical modeling environment, a method of performing structural templatization includes providing a graphical model that has multiple components. The method further includes the step of instantiating an instance of an interface component into the graphical model. The instantiated instance of the interface component exposes at least one external interface port and includes at least one internal port. The method also instantiates an instance of an implementation component into the graphical model. The instantiated instance of the implementation component exposes an external implementation port in the model. The external implementation port and the external interface port are then connected. The model functional content is automatically transferred from the instance of the implementation component to the interior of the instance of the interface component.
In one aspect of the present invention in a graphical modeling environment, a system for performing structural templatizing includes a graphical model with a plurality of components. The system also includes an interface component. An instance of the interface component is instantiated in the graphical model and exposes at least one external interface port. The interface component also includes at least one internal port. The system additionally includes an implementation component. An instance of the implementation component is instantiated in the graphical model. The instance of the implementation component exposes an external implementation port. The external implementation port is connected to the external interface port, and at least one internal port is automatically merging with the functional content of the implementation component.
In an aspect of the present invention in a distributed graphical modeling environment, a system for performing structural templatizing includes a first computing device interfaced with a network. The system also includes a second computing device in communication with the first computing device over the network. The second computing device hosts a graphical modeling environment that includes at least one graphical model. The graphical model has multiple components that include an instance of an interface component and an instance of the implementation component. The instance of the interface component exposes at least one external interface port and includes at least one internal port. The instance of the implementation component includes model functional content and exposes an external implementation port that is connected to the external interface port. The at least one internal port in the instance of the interface component is programmatically merged with the functional content of the instance of the implementation component. The system further includes a display device in communication with the first computing device. The display device displays to a user an output of the graphical modeling environment that is received over the network from the second computing device.
In one aspect of the present invention in a graphical modeling environment, a method of performing structural templatization includes the step of providing a graphical model with multiple components. The method also instantiates an instance of an interface component into the graphical model. The instance of the interface component includes model connection information. The method additionally instantiates an instance of an implementation component into the graphical model. The instance of the implementation component includes model functional content. The method connects an additional model component to an implementation port for the implementation component. The method further includes the step of connecting the interface component and the implementation component via the additional model component. The functional content of the implementation component is propagated programmatically to the interface component and is altered by the additional model component. The altered functional content is programmatically merged with the connection information of the interface component.
In another aspect of the present invention in a graphical modeling environment, a method of performing structural templatization, includes the step of providing a graphical model with a plurality of components. The method instantiates an instance of an interface component into the graphical model. The instance of the interface component includes model connection information. The method also instantiates an instance of an implementation component into the graphical model. The instance of the implementation component includes model functional content. The method additionally connects an additional model component to an implementation port for the implementation component and connects the interface component and the implementation component via the additional model component. The connection information of the interface component is propagated programmatically to the implementation component. The altered connection information is altered by the additional model component and programmatically merged with the functional content of the implementation component.